package com.springcloud.atguigu.service.serviceImpl;

import com.springcloud.atguigu.dao.AccountDao;
import com.springcloud.atguigu.service.AccountService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author :hucaiyuan
 * @date :2022/02/26   15:12
 * @description :
 */
@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    @Override
    @GlobalTransactional(name = "fsp-account",rollbackFor = Exception.class)
    public void decrease(Long userId, BigDecimal money) {
        accountDao.decrease(userId,money);
    }
}
